home *** CD-ROM | disk | FTP | other *** search
/ AOL File Library: 2,801 to 2,900 / aol-file-protocol-4400-2801-to-2900.zip / AOLDLs / C++ Files Library / Graphic Gems I, II & III (C_C++) / Graphics Gems C Code.sea / GemsIII / accurate_scan / fixpoint.h < prev    next >
Text File  |  1992-06-16  |  921b  |  37 lines

  1. #ifndef FIXPOINT_H
  2. #define FIXPOINT_H
  3.  
  4. /* Requires: LOBITS to be divisible by 2, HIBITS<=16, and LOBITS <=16. */
  5.  
  6. #define HIBITS 16
  7. #define LOBITS 16
  8.  
  9. #define LOMASK       (~(0xffffffff << LOBITS))
  10. #define HIMASK       ((~(0xffffffff << HIBITS)) << LOBITS)
  11. #define SIGNBIT      (1 << (HIBITS+LOBITS-1))
  12. #define OVERFLOWMASK (SIGNBIT | ~(HIMASK | LOMASK))
  13.  
  14. typedef int fixpoint;
  15. typedef struct {unsigned int hi, lo, neg;} dblfixpoint;
  16.  
  17. extern int fp_error;
  18. extern  fixpoint fp_max();
  19. extern  fixpoint fp_min();
  20. extern  int fp_integer();
  21. extern  int fp_fraction();
  22. extern  double fp_fraction_double();
  23.  
  24. extern  fixpoint fp_multiply();
  25. extern  void fp_print();
  26. extern  fixpoint fp_fix();
  27. extern double fp_double(fixpoint x);
  28.  
  29. extern int fp_dblnegative();
  30. extern dblfixpoint fp_dblnegate();
  31. extern dblfixpoint fp_dblmultiply();
  32. extern int fp_dbllessthan();
  33. extern dblfixpoint fp_dbladd();
  34. extern fixpoint fp_trunc();
  35.  
  36. #endif
  37.